package com.li.singlepattern;

public class Test {
    public static void main(String[] args) {
        //饿汉式验证
        System.out.println(UserModel.getInstance());
        System.out.println(UserModel.getInstance());
        System.out.println(UserModel.getInstance());
        //懒汉式验证
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(RoleModel1.getInstance());
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(RoleModel1.getInstance());
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(RoleModel1.getInstance());
            }
        }).start();
        //懒汉式验证
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(RoleModel1.getInstance());
            }
        }).start();



    }
}
